//pde项目当确定了setup和draw工程内所有class和函数都可以直接访问

void drawReset(){
 
        generateCount  =0;
       // methodCount --;
      

}

void reset(){
    route = new ArrayList<Cell>();
    Arrays.fill(dist, INF);//填充0x3F3F3F3F
    dist[0] = 0;
    heap.clear();
    heap.add(new PII (f(0),0));
    steps = 0;
    pathCount = 0;
    frameCount = 0;
    findpath = false;
    start = grid[0];
    current = grid[0];
    current.previous = null;
    route.add(start);
    
    
    methodCount ++;
    methodCount %= 4;
    

    
    for(Cell c : grid){
        c.visited = false;
    }
    start.visited = true;
    
    
}
//pair类
class PII implements Comparable<PII>{
    private int first;//距离值
    private int second;//点编号

    public int getFirst()
    {
        return this.first;
    }
    public int getSecond()
    {
        return this.second;
    }
    public PII(int first,int second)
    {
        this.first = first;
        this.second = second;
    }
    @Override
    public int compareTo(PII o) {
        // TODO 自动生成的方法存根
        return Integer.compare(first, o.first);
    }
}


void removeWalls(Cell a,Cell b){//清除a与b之间的墙
//移除墙壁就是把boolean改变
    int x = a.i - b.i;
    if(x == 1){//当前cella在b的右边，清除a的左墙和b的右墙
        a.walls[3] = false;
        b.walls[1] = false;
    }else if(x == -1){
        a.walls[1] = false;
        b.walls[3] = false;
    }

    int y = a.j - b.j;
        if(y == 1){////当前cella在b的下边，清除a的上墙和b的下墙
        a.walls[0] = false;
        b.walls[2] = false;
    }else if(y == -1){
        a.walls[2] = false;
        b.walls[0] = false;
    }
}
